﻿@using PortalIntranet.DatabaseComponents;
@using PortalIntranet.InternalComponents.Configuration;
@using PortalIntranet.InternalComponents.Common;
@using PortalIntranet.ObjectComponents.WebParts.Galerias;

@model PortalIntranet.ObjectComponents.WebParts.WebPartBaseInfo

@{
	var model = (WPGaleria)Model;
}

<div class="w-box-content cnt_a" style="height: @(model.Altura <= 0 ? "auto" : model.Altura.ToString() + "px"); overflow: auto;">
    <ol id="@string.Format("WebPart-{0}-Filter", model.Id.ToString())" class="nav-beoro grid_filters">
        <li data-filter="single_item" class="active">Todos</li>
        <li data-filter="withoutIFrame">Imagens</li>
        <li data-filter="withIFrame">Vídeos</li>
    </ol>
	<div id="@string.Format("WebPart-{0}-Grid", model.Id.ToString())" class="gallery_grid grid_items">
		<ul>
			@{
				string url = string.Empty;
				string css = string.Empty;
				
				foreach (var item in model.Itens)
				{
					url = item.Url;
					css = (item.TipoMedia == TipoMedia.Imagem ? "withoutIFrame" : "withIFrame");
					
					if (item.TipoMedia == TipoMedia.Imagem || item.TipoMedia == TipoMedia.Video)
					{
						url = Url.Content(string.Format("{0}/Imagens/{1}", AppSettings.TemporaryFiles, item.Url));
					}
					
					<li class="single_item @css">
						<a href="@url" title="@item.Descricao" rel="@string.Format("WebPart-{0}-Grid", model.Id.ToString())" class="@css">
							<img src="@Url.Content(string.Format("{0}/Imagens/{1}", AppSettings.TemporaryFiles, item.Thumb))" alt="@item.Nome" />
						</a>
						<p class="imgInfo">@item.Descricao</p>
					</li>
				}
			}
		</ul>
	</div>
</div>
